/**
 * 
 */
package com.jm.web.tags;

import java.util.HashMap;
import java.util.Map;

import com.jm.web.builder.DialogBuilder;
import com.jm.web.form.support.FormItem;
/**
 * @author yanjie
 *
 */
public class DialogTag extends BaseDPTag{
	private static final long serialVersionUID = -2815007377402610525L;
	protected int iTabSize = 0;//重新设定 tabSize的大小
	protected Map<String,FormItem> formItems = null ;
	
	public void addItem(String name,FormItem formItem) {
		if(this.formItems == null )
			this.formItems = new HashMap<String,FormItem>();
		
		this.formItems.put(name, formItem);
	}
	
	public Map<String,FormItem> getItems(){
		return this.formItems;
	}
	
	@Override
	protected void preStartTag() {
		this.getPage().setDialog(this);
		super.preStartTag();
	}
	
	public int getTabSize() {
		return this.iTabSize;
	}

	public void setTabSize(int iTabSize) {
		if(iTabSize > 2)
			iTabSize = 2 ;
		
		this.iTabSize = iTabSize;
	}
	
	@Override
	protected int onStartTag() {
		return super.onStartTag();
	}
	
	@Override
	public void clear() {
		this.formItems = null;
		this.iTabSize = 0;
		super.clear();
	}
	
	@Override
	public String getBuilderName() {
		return DialogBuilder.class.getName();
	}
	
	public void setDbuttons(String strValue) {
		this.SetExtValue("dbuttons",strValue);
	}
	
	public void setDcloseOnEscape(String strValue) {
		this.SetExtValue("dcloseOnEscape",strValue);
	}
	
	public void setDwithClose(String strValue) {
		this.SetExtValue("dwithClose",strValue);
	}
	
	public void setDcloseText(String strValue) {
		this.SetExtValue("dcloseText",strValue);
	}
	
	public void setDialogClass(String strValue) {
		this.SetExtValue("dialogClass",strValue);
	}
	
	public void setDheight(String strValue) {
		this.SetExtValue("dheight",strValue);
	}
	
	public void setDmaxHeight(String strValue) {
		this.SetExtValue("dmaxHeight",strValue);
	}
	
	public void setDminHeight(String strValue) {
		this.SetExtValue("dminHeight",strValue);
	}
	
	public void setDwidth(String strValue) {
		this.SetExtValue("dwidth",strValue);
	}
	
	public void setDmaxWidth(String strValue) {
		this.SetExtValue("dmaxWidth",strValue);
	}
	
	public void setDminWidth(String strValue) {
		this.SetExtValue("dminWidth",strValue);
	}
	
	public void setDposition(String strValue) {
		this.SetExtValue("dposition",strValue);
	}
	
	public void setDresizable(String strValue) {
		this.SetExtValue("dresizable",strValue);
	}
	
	public void setDstack(String strValue) {
		this.SetExtValue("dstack",strValue);
	}
	
	public void setDtitle(String strValue) {
		this.SetExtValue("dtitle",strValue);
	}
	
	public void setDzIndex(String strValue) {
		this.SetExtValue("dzIndex",strValue);
	}
	
	public void setDmodal(String strValue) {
		this.SetExtValue("modal",strValue);
	}
}
